#define _CRT_SECURE_NO_WARNINGS 1
#include<iostream>
using namespace std;
const int N = 110, M = 10010;
int a[N];
bool f[M];
int n;
int gcd(int a, int b)
{
    return b ? gcd(b, a % b) : a;
}
int main()
{
    cin >> n;
    int d = 0;
    for (int i = 1; i <= n; i++)
    {
        cin >> a[i];
        d = gcd(a[i], d);
    }
    if (d != 1)
    {
        cout << "INF" << endl;
        return 0;
    }
    f[0] = true;
    for (int i = 1; i <= n; i++)
    {
        for (int j = a[i]; j < M; j++)
        {
            f[j] |= f[j - a[i]];
        }
    }
    int res = 0;
    for (int i = 0; i < M; i++) if (!f[i]) res++;
    cout << res << endl;
    return 0;
}